#!/bin/csh

if ( $#argv > 1 ) then
   echo 'Usage :' $0 ccyymmddhh
   exit 1
else if ( $#argv == 0 ) then
   echo 'Usage :' $0 ccyymmddhh
   exit 1
endif
setenv runtime $1
setenv y4  `echo $runtime | cut -c1-4`
setenv y2  `echo $runtime | cut -c3-4`
setenv m2  `echo $runtime | cut -c5-6`
setenv d2  `echo $runtime | cut -c7-8`
setenv h2  `echo $runtime | cut -c9-10`

# go to system dir and set environment variables
#####################
cd /home/dataop/scripts-data
source ./settings
setenv logfile "$logdir/gfs.$runtime.log"
###########################################

# check data status
set check = `$downscriptdir/read-status.csh $runtime check`
if ( $check == 0 ) then
else
	$downscriptdir/modify-status.csh $runtime init
endif

msg_log "--------------------------------------------"
msg_log "BEG" `date`
msg_log "--------------------------------------------"
msg_log "CLEANING GFS DATA STATUS... 0"
$downscriptdir/modify-status.csh $runtime gfs 0
msg_log "--------------------------------------------"
msg_log "END" `date`
msg_log "--------------------------------------------"
exit 0
